---
title: Squarespace 案例分析
case_study_styles: true
cid: caseStudies
css: /css/style_case_studies.css
---

<!--
---
title: Squarespace Case Study
case_study_styles: true
cid: caseStudies
css: /css/style_case_studies.css
---
-->

<!-- <div class="banner1 desktop" style="background-image: url('/images/case-studies/squarespace/banner1.jpg')">
  <h1> CASE STUDY:<img src="/images/squarespace_logo.png" class="header_logo"><br>
    <div class="subhead">Squarespace: Gaining Productivity and Resilience with Kubernetes</div>
  </h1>
</div> -->

<div class="banner1 desktop" style="background-image: url('/images/case-studies/squarespace/banner1.jpg')">
  <h1> 案例分析：<img src="/images/squarespace_logo.png" class="header_logo"><br>
    <div class="subhead">Squarespace: 借力 Kubernetes 提升效率和可靠性</div>
  </h1>
</div>

<!-- <div class="details">
    Company &nbsp;<b>Squarespace</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Location &nbsp;<b>New York, N.Y.</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Industry &nbsp;<b>Software as a Service, Website-Building Platform</b>
</div> -->

<div class="details">
    公司名 &nbsp;<b>Squarespace</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;地址 &nbsp;<b>纽约市，纽约州</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;行业 &nbsp;<b>软件服务，网站构建平台</b>
</div>

<hr>
<section class="section1">
<div class="cols">
  <div class="col1">
    <!-- <h2>Challenge</h2>
    Moving from a monolith to microservices in 2014 "solved a problem on the development side, but it pushed that problem to the infrastructure team," says Kevin Lynch, Staff Engineer on the Site Reliability team at Squarespace. "The infrastructure deployment process on our 5,000 VM hosts was slowing everyone down." -->
    <h2>挑战</h2>
    自从 2014 年，我们从 monolith 架构移植到微服务架构，
    “虽然解决了开发端的问题，但却带来了架构组的问题”，Squarespace 网站可靠性组的主任工程师 Kevin Lynch 说道。
    “5000 个 VM 主机上的部署过程，让每个人都举步维艰。”

    <br>
    <!-- <h2>Solution</h2>
    The team experimented with container orchestration platforms, and found that Kubernetes "answered all the questions that we had," says Lynch. The company began running Kubernetes in its data centers in&nbsp;2016. -->
    <h2>解决方案</h2>
      网站可靠性组开始尝试使用不同的容器编排平台，然后发现 Kubernetes “解决了我们所有的既有问题”，Lynch 说道。于是整个公司在 2016 年开始在自己的数据中心中运行 Kubernetes 集群。
  </div>

  <div class="col2">

<!-- <h2>Impact</h2>
Since Squarespace moved to Kubernetes, in conjunction with modernizing its networking stack, deployment time has been reduced by almost 85%.
Before, their VM deployment would take half an hour; now, says Lynch, "someone can generate a templated application, deploy it within five minutes,
and have actual instances containerized, running in our staging environment at that point." Because of that, "productivity time is the big cost saver,"
he adds. "When we started the Kubernetes project, we had probably a dozen microservices. Today there are twice that in the pipeline being actively worked on."
Resilience has also been improved with Kubernetes: "If a node goes down, it’s rescheduled immediately and there’s no performance&nbsp;impact." -->

<h2>影响</h2>
自从 Squarespace 开始全面使用 Kubernetes，伴随着网络技术栈的革新，部署时间大幅减少85%。
以前，他们的 VM 部署需要耗费半个小时；现在，Lynch 提到，“一个人可以生成一个模板应用，在五分钟内部署，并将实例容器化，并在模拟环境下运行。”正因为如此，“开发效率节省了大量的成本。”
他又补充道，“当我们开始用 Kubernetes 时，我们可能只有十几个微服务。而现在的任务栏里面已经有两倍多的微服务正在进行中。”
Kubernetes 也同样提升了可靠性：“如果一个节点宕掉，马上会重新调度一个新的节点，没有任何性能上的影响。”

</div>

</div>
</section>
<div class="banner2">
  <div class="banner2text">
    <iframe width="560" height="315" src="https://www.youtube.com/embed/feQkzJkW-SA" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>
    <br><br>“一旦你验证了 Kubernetes 可以解决一个问题，每个人都会立即着手解决其它的问题，无需你的布道。”
<br style="height:25px"><span style="font-size:14px;letter-spacing:2px;text-transform:uppercase;margin-top:5% !important;"><br>— Kevin Lynch，Squarespace 网站可靠性组的主任工程师</span>
  </div>
</div>
<section class="section2">
<div class="fullcol">
  <!-- <h2>Since it was started in a dorm room in 2003, Squarespace has made it simple for millions of people to create their own websites.</h2> -->
  <h2>从 2003 年宿舍起步， Squarespace 已经为数百万人提供了网站构建服务。</h2>

  <!-- Behind the scenes, though, the company’s monolithic Java application was making things not so simple for its developers to keep improving the platform.
  So in 2014, the company decided to "go down the microservices path," says Kevin Lynch, staff engineer on Squarespace’s Site Reliability team.
  "But we were always deploying our applications in vCenter VMware VMs [in our own data centers]. Microservices solved a problem on the development side,
  but it pushed that problem to the Infrastructure team. The infrastructure deployment process on our 5,000 VM hosts was slowing everyone down."<br><br> -->

  但在幕后，公司的单体应用却让开发人员在平台创新上举步维艰。所以在 2014 年，公司决定”走微服务之路”，Kevin Lynch 提到，Squarespace 网站稳定性组的主任工程师。
  “但是我们还是一直在自己的 vCenter VMware 虚拟机[我们自己的数据中心]上部署应用。微服务解决了开发端的问题，但是让问题转变到了基础架构组这一边。我们在5000个虚拟机主机上的部署流程让每个人的开发效率都提高不起来。”

  <!-- After experimenting with another container orchestration platform and "breaking it in very painful ways," Lynch says,
  the team began experimenting with Kubernetes in mid-2016 and found that it "answered all the questions that we had."
  Deploying it in the data center rather than the public cloud was their biggest challenge, and at the time, not a lot of other companies were doing that.
  "We had to figure out how to deploy this in our infrastructure for ourselves, and we had to integrate it with our other applications," says Lynch.<br><br> -->

  在尝试过另外一个容器编排平台，“非常痛苦地拆解它”，Lynch 说道，我们组开始在 2016 年年中尝试 Kubernetes，发现它“能解决我们所有的问题”。
  将 Kubernetes 部署在数据中心，而非公有云上是我们最大的挑战，但在当时，并没有很多其它的公司会这么做。
  “我们必须要自己摸索出如何在自己的基础架构中部署它，我们也必须要将其和我们其它的应用做集成，”Lynch补充道。<br><br>

  <!-- At the same time, Squarespace’s Network Engineering team was modernizing its networking stack, switching from a traditional layer-two network to a layer-three spine-and-leaf network.
  "It mapped beautifully with what we wanted to do with Kubernetes," says Lynch. "It gives us the ability to have our servers communicate directly with the top-of-rack switches. We use Calico for
  <a href="https://github.com/containernetworking/cnihttps://github.com/containernetworking/cni">CNI networking for Kubernetes</a>,
  so we can announce all these individual Kubernetes pod IP addresses and have them integrate seamlessly with our other services that are still provisioned in the VMs." -->

  与此同时，Squarespace 的网络工程组也正在革新它们的网络技术栈，从传统的 L2 网络转变为 L3 脊叶网络架构。
  “” Lynch 说道，“它给了我们服务器直接通过架顶交换机通信的能力。我们使用 Calico 作为
  <a href="https://github.com/containernetworking/cnihttps://github.com/containernetworking/cni">Kubernetes 的 CNI 网络插件</a>”，
  因而，我们可以为每个 Kubernetes pod 分配 IP 地址，并将它们和其它仍在虚拟机中创建的服务无缝衔接。

</div>
</section>

<div class="banner3" style="background-image: url('/images/case-studies/squarespace/banner3.jpg')">
  <!-- <div class="banner3text">
    After experimenting with another container orchestration platform and "breaking it in very painful ways,"
    Lynch says, the team began experimenting with Kubernetes in mid-2016 and found that it "answered all the questions that we had."
  </div> -->
  <div class="banner3text">
    在尝试过另外一个容器编排平台，“非常痛苦地拆解它”，Lynch 说道，我们组开始在 2016 年年中尝试 Kubernetes，发现它“能解决我们所有的问题”。
  </div>
</div>

<section class="section3">
<div class="fullcol">
  <!-- Within a couple months, they had a stable cluster for their internal use, and began rolling out Kubernetes for production.
  They also added Zipkin and CNCF projects <a href="https://prometheus.io/">Prometheus</a> and <a href="https://www.fluentd.org/">fluentd</a> to their cloud native stack.
  "We switched to Kubernetes, a new world, and we revamped all our other tooling as well," says Lynch. "It allowed us to streamline our process,
  so we can now easily create an entire microservice project from templates, generate the code and deployment pipeline for that, generate the Docker file,
  and then immediately just ship a workable, deployable project to Kubernetes." Deployments across Dev/QA/Stage/Prod were also "simplified drastically," Lynch adds.
  "Now there is little configuration variation." -->

  几个月的时间，它们就有了一个稳定的集群供内部使用，并开始在生产环境下使用 Kubernetes。
  他们同时还在自己的云原生技术栈中用到了 Zipkin 和 CNCF 项目 <a href="https://prometheus.io/">Prometheus</a> and <a href="https://www.fluentd.org/">fluentd</a> 。
  “我们换到 Kubernetes，就像进入了一个新世界，我们也同时改进了其它的工具，” Lynch 说道。“它让我们简化了流程，因而，我们才能更加方便地从模板中创建整个微服务项目，生成代码和部署管道，生成 Docker 文件，
  并迅速地将可用的、可部署的项目发布到 Kubernetes 集群上。”在 Dev/QA/Stage/Prod 不同环境间的部署也变得 “异常的简单，” Lynch 补充道。
  “现在，环境间的配置差异变得很小。”

<br><br>
  <!-- And the whole process takes only five minutes, an almost 85% reduction in time compared to their VM deployment.
  "From end to end that probably took half an hour, and that’s not accounting for the fact that an infrastructure engineer would be responsible for doing that,
  so there’s some business delay in there as well." -->

  而且整个部署过程只需要五分钟，和虚拟机部署相比，几乎节约了 85% 的时间。
  “从端到端可能要半个小时，这还没有考虑可能需要基础架构工程师来做这方面的工作，因而，也还有一些业务上的延时。”
<br><br>
  <!-- With faster deployments, "productivity time is the big cost saver," says Lynch. "We had a team that was implementing a new file storage service,
  and they just started integrating that with our storage back end without our involvement"—which wouldn’t have been possible before Kubernetes.
  He adds: "When we started the Kubernetes project, we had probably a dozen microservices. Today there are twice that in the pipeline being actively worked on." -->

  部署变快之后，“开发效率节省了大量的成本，” Lynch 提到，“我们有个组想要实现新的文件存储服务，他们就径直和我们的存储后来做了集成，而不需要我们的参与”，这在采用 Kubernetes 之前是不可想象的。
  他又补充道：“在我们开始 Kubernetes 项目时，我们可能只有十几个微服务。而现在的任务栏里面已经有两倍多的微服务正在进行中。”



</div>
</section>
<div class="banner4" style="background-image: url('/images/case-studies/squarespace/banner4.jpg')">
  <div class="banner4text">
  <!-- "We switched to Kubernetes, a new world....It allowed us to streamline our process, so we can now easily create an entire microservice project from templates,"
  Lynch says. And the whole process takes only five minutes, an almost 85% reduction in time compared to their VM deployment. -->

  “我们换到 Kubernetes，就像进入了一个新世界....它让我们简化了流程，因而，我们才能更加方便地从模板中创建整个微服务项目，”
  Lynch 说道。整个部署过程只需要五分钟，和虚拟机部署相比，几乎节约了 85% 的时间。
  </div>
</div>

<section class="section5" style="padding:0px !important">
<div class="fullcol">
  <!-- There’s also been a positive impact on the application’s resilience. "When we’re deploying VMs, we have to build tooling to ensure that a service is
  spread across racks appropriately and can withstand failure," he says. "Kubernetes just does it. If a node goes down,
  it’s rescheduled immediately and there’s no performance impact." -->

  同样在应用程序的可靠性方面也有积极的影响。“当我们在部署虚拟机时，我们需要工具来保障服务散布在机架间，可以承受失败，”他说道，“Kubernetes 正好可以做到这一点。如果节点宕掉，可以马上重新调度，没有性能影响。”
<br><br>
  <!-- Another big benefit is autoscaling. "It wasn’t really possible with the way we’ve been using VMware," says Lynch, "but now we can just
  add the appropriate autoscaling features via Kubernetes directly, and boom, it’s scaling up as demand increases. And it worked out of the box." -->

  另一个很大的好处就是扩缩容。“按照我们使用 VMware 的方式，扩缩容好像不可能实现，”Lynch 说道，“但现在，我们可以直接通过 Kubernetes 加入合适的扩缩容功能，然后，随着需求的增加而扩容。开箱即用！”
<br><br>
  <!-- For others starting out with Kubernetes, Lynch says his best advice is to "fail fast": "Once you’ve planned things out, just execute.
  Kubernetes has been really great for trying something out quickly and seeing if it works or not." -->

  针对刚开始使用 Kubernetes 的人，Lynch 说他最后的建议就是“快速失败”：“一旦计划后，马上执行。Kubernetes 真的是非常适合快速实验，看看是否可行。”

</div>

<div class="banner5">
  <div class="banner5text">
    <!-- "When we’re deploying VMs, we have to build tooling to ensure that a service is spread across racks appropriately and can withstand failure,"
    he says. "Kubernetes just does it. If a node goes down, it’s rescheduled immediately and there’s no performance impact." -->

    “当我们在部署虚拟机时，我们需要工具来保障服务散布在机架间，可以承受失败，”他说道，“Kubernetes 正好可以做到这一点。如果节点宕掉，可以马上重新调度，没有性能影响。”

  </div>
</div>

<div class="fullcol">
  <!-- Lynch and his team are planning to open source some of the tools they’ve developed to extend Kubernetes and use it as an API itself.
  The first tool injects dependent applications as containers in a pod.
  "When you ship an application, usually it comes along with a whole bunch of dependent applications that need to be shipped with that,
  for example, fluentd for logging," he explains. With this tool, the developer doesn’t need to worry about the configurations. -->

  Lynch 和他的小组正准备开源一些他们的工具，这些工具用来延展 Kubernetes，将其作为 API 使用。
  第一个工具在 pod 将依赖应用作为容器注入。
  “当你在发布应用时，常常需要一系列的依赖应用，例如，日志用的 fluentd，” 他解释道。
  有了这个工具，开发人员就不需要担心配置了。

<br><br>
  <!-- Going forward, all new services at Squarespace are going into Kubernetes, and the end goal is to convert everything it can. About a quarter of
  existing services have been migrated. "Our monolithic application is going to be the last one, just because it’s so big and complex," says Lynch.
  "But now I’m seeing other services get moved over, like the file storage service. Someone just did it and it worked—painlessly. So I believe if we tackle it,
  it’s probably going to be a lot easier than we fear. Maybe I should just take my own advice and fail fast!" -->

  自此之后，Squarespace 所有新的微服务都将直接部署到 Kubernetes 上，而最终的目标是要扩大到所有的服务上。
  现在已经有四分之一的服务已经移植完。“我的单体应用将是最后一个被移植的，仅仅是以为它太大、太复杂，”Lynch 说道。
  “但现在我已经看到其它的服务已经被移植到 Kubernetes 上，例如文件存储服务。有人解决了，而且并不复杂。
  所以我坚信如果我们着手解决它，很可能回避我们所担心的要轻松许多。也许我应该接受自己的建议，“快速失败”！”

</div>

</section>
